package com.longcai.piaojia.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/8/30.
 */
@HttpInlet(Conn.USER_GETCODE)
public class GetCodePost extends BaseAsyPost<GetCodePost.CodeEntity> {

    public String phone, type, change;

    public GetCodePost(AsyCallBack<CodeEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected CodeEntity parser(JSONObject object) throws Exception {

        TOAST = object.optString("message");

        if(object.optInt("code")==200){

            JSONObject jsonObject = object.optJSONObject("data");

            CodeEntity codeEntity = new CodeEntity();
            codeEntity.code = jsonObject.optInt("code");
            codeEntity.phone = jsonObject.optString("phone");

            return codeEntity;

        }

        return null;
    }

    public class CodeEntity {

        public String phone;
        public int code;

    }

}
